//
//  FnScreenVideoAd.m
//  flutter_fn_sdk
//
//  Created by xiaomin huang on 2022/8/3.
//

#import "FnScreenVideoAd.h"
#import "FnSdkHeader.h"

@interface FnScreenVideoAd ()<FNInitalizeInterstitialFullScreenDelegate>

@property (strong, nonatomic) FNInitalizeInterstitialFullScreen *screenAd;

@end

@implementation FnScreenVideoAd


+(instancetype)loadAdWithAppId:(NSString *)appId adsId:(NSString *)adsId isRelease:(BOOL)release{

    return [[FnScreenVideoAd alloc] initWithAppId:appId adsId:adsId isRelease:release];
}

- (instancetype)initWithAppId:(NSString *)appId adsId:(NSString *)adsId isRelease:(BOOL)release
{
    self = [super init];
    if (self) {
        self.screenAd = [[FNInitalizeInterstitialFullScreen alloc] initWithPlacementId:appId adsId:adsId];
        //开发环境(测试ID)为NO 生产环境(正式ID)为YES
        self.screenAd.isRelease = release;
        self.screenAd.delegate = self;
        [self.screenAd loadFnInterstitialFullScreenAd];
        
    }
    return self;
}

/// 关闭全屏插屏广告
-(void)closeScreenVideoAd{

}

//点击
- (void)fnFullScreenInterstitialClicked {
    if (self.onClicked) {
        self.onClicked();
    }
}

//关闭
- (void)fnFullScreenInterstitialClosed {
    if (self.onClosed) {
        self.onClosed();
    }
}

//错误
- (void)fnFullScreenInterstitialError:(nonnull NSError *)error {
    if (self.onError) {
        self.onError(error);
    }
}

//显示
- (void)fnFullScreenInterstitialShow {
    if (self.onShow) {
        self.onShow();
    }
}

- (void)dealloc{
    self.screenAd.delegate = nil;
    NSLog(@"FnScreenVideoAd - dealloc");
}

@end
